package com.qf.service.Impl;

import com.qf.dao.RoleDao;
import com.qf.service.RoleService;
import com.qf.pojo.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @ClassName RoleServiceImpl
 * @Author xiao宋
 * @Date 8:43  2022/10/11
 * @Version 1.0
 * @Description TODO
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleDao roleDao;

    @Override
    public Set<String> findRolesByUserId(int uId) {
        List<SysRole> roleList = roleDao.findRolesByUserId(uId);
        Set<String> list = roleList.stream().map((role) -> {
            return role.getName();
        }).collect(Collectors.toSet());
        return list;
    }
}
